package com.example.demo.service;

import com.example.demo.mapper.UserInfoMapper;
import com.example.demo.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yanglup
 * @create 2020-12-12 16:34
 */
@Service
public class UserInfoServiceImpl implements UserInfoService{
    @Autowired
    UserInfoMapper userInfoMapper;

    /**查询是否有用户信息*/
    @Override
    public Integer userInfocheck(String openid) {
        try {
            userInfoMapper.userInfocheck(openid);
            return 1;
        }catch (Exception e){
            return 0;
        }
    }

    /**插入用户信息*/
    @Override
    public void userInfoadd(String openid, String nickName, Integer gender, String city, String province, String country,String avatarUrl) {
        userInfoMapper.userInfoadd(openid,nickName,gender,city,province,country,avatarUrl);
    }


    /**************************************************************userInfoBack后台管理系统**************************************************************************/
    /**用户后管理*/
    @Override
    public List<UserInfo> BackUserInfolist() {
        return userInfoMapper.BackUserInfolist();
    }
    /**用户管理列表数量*/
    @Override
    public Integer BackUserInfolistnumber() {
        return userInfoMapper.BackUserInfolistnumber();
    }


    /**删除用户*/
    @Override
    public void BackUserInfodelete(String openid) {
        userInfoMapper.BackUserInfodelete(openid);
    }


}
